The fundamental friction in computational physics arises because computers represent real numbers using binary floating-point math. Unlike human Base-10 (decimal) thinking, hardware stores values in Base-2 (binary). This results in a leaky abstraction: simple decimal fractions like 0.1 cannot be represented precisely.
1. The Floating-Point Reality
Go provides two primary types for real numbers: float32 and float64. When using short variable declaration syntax like price := 0.0, Go defaults to float64. These types are approximations of reality, not exact mathematical values.
2. The Mystery of 0.1
In Base-10, $1/3$ results in an infinite repeating decimal ($0.333...$). In Base-2, the value $0.1$ results in an infinite repeating fraction. Because computer memory is finite, this fraction is truncated, leading to cumulative errors. For example, $0.1 + 0.2$ yields $0.30000000000000004$ rather than exactly $0.3$.
Warning: Never use == to compare floating-point numbers in logic gates, as these microscopic discrepancies will cause comparisons to fail.